package com.jrx.anytxn.investor.handler;

import com.jrx.anytxn.common.exception.TxnException;
import com.jrx.anytxn.investor.dto.loan.InvestorCancelLoanReq;
import com.jrx.anytxn.investor.dto.loan.InvestorCancelLoanRes;
import com.jrx.anytxn.investor.bean.InvestorAfterSucSaveBean;
import com.jrx.anytxn.investor.dto.loan.LoanReq;
import com.jrx.anytxn.investor.dto.loan.LoanRes;

import java.util.Date;

/**
 * 联合贷放款处理接口
 *
 * @author liuyang
 * @date 2020-05-18
 */
public interface IInvestorLoanHandler {

    /**
     * 联合贷放款
     *
     * @param loanReq 放款请求信息
     * @return LoanRes 放款结果
     * @throws Exception
     * @author liuyang
     * @date 2020-05-18
     */
    LoanRes loan(LoanReq loanReq) throws Exception;

    /**
     * 到账日起息，到账成功后处理
     *
     * @param loanId 贷款id
     * @param custId 客户id
     * @param tenantId 租户id
     * @param businessDate 业务日期
     * @return InvestorAfterSucSaveBean 到账日起息保存Bean
     * @throws TxnException
     * @author liuyang
     * @date 2020-06-03
     */
    InvestorAfterSucSaveBean afterLoanSuccuss(String loanId, String custId, String tenantId, Date businessDate) throws TxnException;

    /**
     * 联合贷放款失败取消订单
     *
     * @param req 联合贷放款失败取消订单请求实体
     * @return InvestorCancelLoanRes 联合贷放款失败取消订单响应实体
     * @throws Exception
     * @author liuyang
     * @date 2020-06-05
     */
    InvestorCancelLoanRes cancelLoan(InvestorCancelLoanReq req) throws Exception;
}
